import { request } from '../../request/index.js'

Page({
  data: {
    swiperList: [],
    cateList: [],
    floorList: []
  },
  //options(Object)
  onLoad: function (options) {
    this.getSwiperList()
    this.getCateList()
    this.getFloorList()
  },
  // 获取轮播图数据
  async getSwiperList() {
    const { data: res } = await request({
      url: '/home/swiperdata'
    })
    if (res.meta.status !== 200) return
    this.setData({
      swiperList: res.message
    })
  },
  // 获取分类导航数据
  async getCateList() {
    const { data: res } = await request({
      url: '/home/catitems'
    })
    if (res.meta.status !== 200) return
    this.setData({
      cateList: res.message
    })
  },
  // 获取楼层数据
  async getFloorList() {
    const { data: res } = await request({
      url: '/home/floordata'
    })
    if (res.meta.status !== 200) return
    this.setData({
      floorList: res.message
    })
  }
});
